//
//  DeterenceBaseViewController.m
//  safeLady
//
//  Created by xmy on 2017/1/12.
//  Copyright © 2017年 xmy. All rights reserved.
//

#import "DeterenceBaseViewController.h"
#import "DeterenceBackAnimationView.h"
@interface DeterenceBaseViewController ()
@property (strong, nonatomic) DeterenceBackAnimationView * deterenceBackAnimationView;
@end

@implementation DeterenceBaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
     [self.view insertSubview:self.electricWaveView atIndex:0];
     [self.view insertSubview:self.deterenceBackAnimationView atIndex:1];
    [self.deterenceBackAnimationView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).with.offset(-215);
        make.height.equalTo(@160);
        make.width.equalTo(@160);
        make.centerX.equalTo(self.view);
    }];
    [self.view addSubview:self.callPolice];
    [self.callPolice mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).with.offset(-52);
        make.height.equalTo(@54);
        make.width.equalTo(@163);
        make.centerX.equalTo(self.view);
    }];
    @weakify(self)
    [[self.callPolice rac_signalForControlEvents:UIControlEventTouchUpInside]
     subscribeNext:^(id x) {
         @strongify(self)
         [self callPhonesActionSheet:@"110"];
     }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:YES];
}

-(DeterenceBackAnimationView *)deterenceBackAnimationView{
    if(!_deterenceBackAnimationView){
        NSArray* nibView     = [[NSBundle mainBundle] loadNibNamed:@"DeterenceBackAnimationView" owner:nil options:nil];
        _deterenceBackAnimationView       = [nibView objectAtIndex:0];
//        _deterenceBackAnimationView.frame = CGRectMake(0, 0, 160,160);
    }
    return _deterenceBackAnimationView;
}
-(ElectricWaveView *)electricWaveView{
    if(!_electricWaveView){
        NSArray* nibView     = [[NSBundle mainBundle] loadNibNamed:@"ElectricWaveView" owner:nil options:nil];
        _electricWaveView       = [nibView objectAtIndex:0];
        _electricWaveView.frame = self.view.frame;
    }
    return _electricWaveView;
}
-(UIButton *)callPolice{
    if(!_callPolice){
        _callPolice = [UIButton buttonWithType:UIButtonTypeCustom];
        [_callPolice setImage:[UIImage imageNamed:@"拨打110"] forState:UIControlStateNormal];
    }
    return _callPolice;
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
